package com.bjsxt.chapter4_prototype;

import java.util.Date;

/**
 * @ClassName Sheep2
 * @Description 1997年英国的克隆羊多利
 * @Author 黑马程序员
 * @Date 11:01 2024/6/21
 * @Version 1.0
 **/
public class Sheep2 implements Cloneable{

    private Date birthDay;

    private String name;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        // 直接调用object对象的clone()方法
        Object obj = super.clone();
        Sheep2 s = (Sheep2) obj;
        s.birthDay = (Date) this.birthDay.clone();
        return obj;
    }

    public Sheep2() {
    }

    public Sheep2(Date birthDay, String name) {
        this.birthDay = birthDay;
        this.name = name;
    }

    public Date getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(Date birthDay) {
        this.birthDay = birthDay;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
